/* $Id:arguments.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#include <sigc++/signal.h>

///The name of the command-line tool
#define ARG_PROGRAM "=program"

///The usage string in the help page
#define ARG_USAGE "=usage"

///Description in text
#define ARG_DESCR "=descr"

///Possible example of usage
#define ARG_EXAMPLE "=example"

///Report bugs to
#define ARG_BUGS "=bugs"

///Version number
#define ARG_VERSION "=version"

///Build date
#define ARG_DATE "=date"

///Copyright notice
#define ARG_COPYRIGHT "=copyright"

/// Add a new argument definition to parse
/** Fill the argument data structure
*/
void arg_add(
    std::string arg,    ///< Name of the argument
    std::string param,  ///< Parameter of argument name, optional when between [], empty is no arg
    std::string group,  ///< Group of the argument in the help page
    std::string text,   ///< Text description
    sigc::signal<void, std::string> handler   ///< Function to call when this argument is found or NULL
);

/// Alternative name of the last argument
void arg_extra(
    std::string arg,    ///< Alternative name of the argument
    std::string param   ///< Argument description, optional show between [], empty is no argument
);

/// Routine that scans the arguments and invokes the various functions on them
/** This routine also handles --help and --version calls and exists then directly
*/
void arg_parse(
    int args,           ///< Number of command line arguments
    char *argv[]        ///< Array of the cmmand line argument strings
);
